package com.example.demo111111.controller;


import com.example.demo111111.entity.Merchant;
import com.example.demo111111.Result.PageResult;
import com.example.demo111111.service.MerchantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController
@RequestMapping("/merchant")
public class MerchantController {

    @Autowired
    MerchantService merchantService;

    @PostMapping
    public Boolean save(@RequestBody Merchant merchant){

        Boolean result= merchantService.save(merchant);
        return result;

    }

    @PutMapping
    public Boolean update(@RequestBody Merchant merchant){
        Boolean result= merchantService.update(merchant);
        return result;
    }

    @GetMapping ("/pageQuery")
    public PageResult pageQuery(Merchant merchant){
        PageResult pageResult= merchantService.pageQuery(merchant);
        return pageResult;
    }

    @DeleteMapping
    public Boolean delete(@RequestParam List<Long> ids) {
        Boolean result= merchantService.deltete(ids);
        return result;
    }


}
